﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using PloobsEngine.Entity;

namespace PloobsEngine
{
    /// <summary>
    /// Classe que tem seu metodo Update Chamado todo Frame
    /// </summary>
    public class IUpdateable : IEntity
    {

        private int id;
        protected EngineStuff engine;
        public IUpdateable(EngineStuff engine)
        {
            this.engine = engine;           
            EntityMapper.getInstance().AddEntity(this);
        }

        ~IUpdateable()
        {
            EntityMapper.getInstance().RemoveEntity(this);
        }

        public void Start()
        {
            this.engine.EngineUpdate += Update;
        }
        public void Stop()
        {
            this.engine.EngineUpdate -= Update;
        }

        public virtual void Update(GameTime gameTime)
        {
        }

        #region IEntity Members

        public int getId()
        {
            return this.id;
        }

        public void setId(int id)
        {
            this.id = id;
        }

        #endregion
    }
}
